#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 5000
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf
#RUN apt-get update -y
#RUN apt-get install -y libgdiplus
#RUN apt-get clean
#RUN ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["YiSha.Web/YiSha.Admin.Web/YiSha.Admin.Web.csproj", "YiSha.Web/YiSha.Admin.Web/"]
COPY ["YiSha.Business/YiSha.Business/YiSha.Business.csproj", "YiSha.Business/YiSha.Business/"]
COPY ["YiSha.Util/YiSha.CodeGenerator/YiSha.CodeGenerator.csproj", "YiSha.Util/YiSha.CodeGenerator/"]
COPY ["YiSha.Business/YiSha.Business.Cache/YiSha.Business.Cache.csproj", "YiSha.Business/YiSha.Business.Cache/"]
COPY ["YiSha.Cache/YiSha.Cache.Factory/YiSha.Cache.Factory.csproj", "YiSha.Cache/YiSha.Cache.Factory/"]
COPY ["YiSha.Util/YiSha.Util/YiSha.Util.csproj", "YiSha.Util/YiSha.Util/"]
COPY ["YiSha.Entity/YiSha.Enum/YiSha.Enum.csproj", "YiSha.Entity/YiSha.Enum/"]
COPY ["YiSha.Cache/YiSha.MemoryCache/YiSha.MemoryCache.csproj", "YiSha.Cache/YiSha.MemoryCache/"]
COPY ["YiSha.Cache/YiSha.Cache.Interface/YiSha.Cache.Interface.csproj", "YiSha.Cache/YiSha.Cache.Interface/"]
COPY ["YiSha.Cache/YiSha.RedisCache/YiSha.RedisCache.csproj", "YiSha.Cache/YiSha.RedisCache/"]
COPY ["YiSha.Entity/YiSha.Entity/YiSha.Entity.csproj", "YiSha.Entity/YiSha.Entity/"]
COPY ["YiSha.Util/YiSha.IdGenerator/YiSha.IdGenerator.csproj", "YiSha.Util/YiSha.IdGenerator/"]
COPY ["YiSha.Web/YiSha.Web.Code/YiSha.Web.Code.csproj", "YiSha.Web/YiSha.Web.Code/"]
COPY ["YiSha.Data/YiSha.Data.Repository/YiSha.Data.Repository.csproj", "YiSha.Data/YiSha.Data.Repository/"]
COPY ["YiSha.Data/YiSha.Data/YiSha.Data.csproj", "YiSha.Data/YiSha.Data/"]
COPY ["YiSha.Data/YiSha.Data.EF/YiSha.Data.EF.csproj", "YiSha.Data/YiSha.Data.EF/"]
COPY ["YiSha.Business/YiSha.Service/YiSha.Service.csproj", "YiSha.Business/YiSha.Service/"]
COPY ["YiSha.Entity/YiSha.Model/YiSha.Model.csproj", "YiSha.Entity/YiSha.Model/"]
COPY ["YiSha.Business/YiSha.Business.AutoJob/YiSha.Business.AutoJob.csproj", "YiSha.Business/YiSha.Business.AutoJob/"]
RUN dotnet restore "YiSha.Web/YiSha.Admin.Web/YiSha.Admin.Web.csproj"
COPY . .
WORKDIR "/src/YiSha.Web/YiSha.Admin.Web"
RUN dotnet build "YiSha.Admin.Web.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "YiSha.Admin.Web.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "YiSha.Admin.Web.dll"]